<!-- $Id: goods_list.htm 17126 2010-04-23 10:30:26Z liuhui $ -->

{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}

<!-- 商品搜索 -->
<div class="form-div">
  <form action="javascript:searchGoods()" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
   <select name="cat_id"><option value="-1">请选择分类</option>{$cat_list}</select>
    <!-- 分类 -->
    <select name="goods_id" id="goodsDiv"><option value="-1">请选择商品</option>{$storage_goods_list}</select>
    <!-- 品牌 -->
    <select name="storage_id"><option value="-1">请选择仓库</option>{html_options selected=$storage_id  options=$storage_list}</select>
   
    <!-- 关键字 -->
    {$lang.keyword} <input type="text" name="keyword" size="15" />
    <input type="submit" value="{$lang.button_search}" class="button" />
  </form>
</div>

{literal}
<script language="JavaScript">
    function searchGoods()
    {
{/literal}
     
        listTable.filter['cat_id'] = document.forms['searchForm'].elements['cat_id'].value;
        listTable.filter['goods_id'] = document.forms['searchForm'].elements['goods_id'].value;
	
        listTable.filter['storage_id'] = document.forms['searchForm'].elements['storage_id'].value;
        
     
      
{literal}
        listTable.filter['keyword'] = Utils.trim(document.forms['searchForm'].elements['keyword'].value);
        listTable.filter['page'] = 1;
		
			
	listTable.listCallback = function(result, txt)
	{
	  if (result.error > 0)
	  {
	    alert(result.message);
	  }
	  else
	  {
	    try
	    {
	      document.getElementById('listDiv').innerHTML = result.content;
	    
	      if(result.select!=null)
	    	  {
	    	  document.getElementById('goodsDiv').innerHTML = result.select;
	    	  }
	      
	      if (typeof result.filter == "object")
	      {
	        listTable.filter = result.filter;
	      }
	
	      listTable.pageCount = result.page_count;
	    }
	    catch (e)
	    {
	      alert(e.message);
	    }
	  }
	}

        listTable.loadList();
    }
</script>
{/literal}
<!-- 商品列表 -->
<form method="post" action="" name="listForm" onsubmit="return confirmSubmit(this)">
  <!-- start goods list -->
  <div class="list-div" id="listDiv">
{/if}
<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
     
     <!--  <a href="javascript:listTable.sort('goods_id'); ">{$lang.record_id}</a> -->序号
    </th>
	 <th>仓库</th>
    <th>商品名称</th>
   <th>库存</th>
    <th>入库</th>
  <th>出库</th>
 
  <tr>
  {foreach from=$goods_list item=goods}
  <tr>
    <td align="center">{$goods.id}</td>
	<td align="center">{$goods.store_name}</td>
    <td class="first-cell" style="{if $goods.is_promote}color:red;{/if}"><span>{$goods.goods_name|escape:html}</span></td>
   <td align="center"><span id="number{$goods.id}">{$goods.number}</span></td>
    <td align="center">+<span onclick="listTable.edit(this, 'edit_add_number', {$goods.id})">0</span></td>
  <td align="center">-<span onclick="listTable.edit(this, 'edit_cut_number', {$goods.id})">0</span></td>
   
  </tr>
  {foreachelse}
  <tr><td class="no-records" colspan="10">{$lang.no_records}</td></tr>
  {/foreach}
</table>
<!-- end goods list -->

<!-- 分页 -->
<table id="page-table" cellspacing="0">
  <tr>
    <td align="right" nowrap="true">
    {include file="page.htm"}
    </td>
  </tr>
</table>

{if $full_page}
</div>

<div>

</div>
</form>

<script type="text/javascript">
  listTable.recordCount = {$record_count};
  listTable.pageCount = {$page_count};

  {foreach from=$filter item=item key=key}
  listTable.filter.{$key} = '{$item}';
  {/foreach}

  {literal}
  onload = function()
  {
    startCheckOrder(); // 开始检查订单
    document.forms['listForm'].reset();
  }

{/literal}
</script>
{include file="pagefooter.htm"}
{/if}